# create a new virthost server system
# NOTE: should be used with --limit most of the time
# NOTE: most of these vars_path come from group_vars/backup_server or from hostvars

- name: make virthost server system
  hosts: virthost15.phx2.fedoraproject.org:bvirthost07.phx2.fedoraproject.org:buildvmhost-10.phx2.fedoraproject.org:buildvmhost-11.phx2.fedoraproject.org:buildvmhost-12.phx2.fedoraproject.org:virthost01.phx2.fedoraproject.org:virthost03.phx2.fedoraproject.org:ibiblio04.fedoraproject.org:bvirthost06.phx2.fedoraproject.org:bvirthost08.phx2.fedoraproject.org:bvirthost09.phx2.fedoraproject.org:bvirthost10.phx2.fedoraproject.org:bvirthost11.phx2.fedoraproject.org:virthost16.phx2.fedoraproject.org:virthost17.phx2.fedoraproject.org:virthost18.phx2.fedoraproject.org:serverbeach07.fedoraproject.org:qa07.qa.fedoraproject.org:coloamer01.fedoraproject.org:qa04.qa.fedoraproject.org:qa05.qa.fedoraproject.org:osuosl03.fedoraproject.org:qa06.qa.fedoraproject.org
  user: root
  accelerate: "{{ accelerated }}"
  gather_facts: True

  vars_files: 
   - /srv/web/infra/ansible/vars/global.yml
   - "{{ private }}/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - base
  - rkhunter
  - { role: denyhosts, when: ansible_distribution_major_version != '7' }
  - nagios_client
  - hosts
  - fas_client
  - collectd/base
  - { role: iscsi_client, when: datacenter == "phx2" }
  - sudo

  tasks:
  - include: "{{ tasks }}/yumrepos.yml"
  - include: "{{ tasks }}/2fa_client.yml"
  - include: "{{ tasks }}/motd.yml"
  - include: "{{ tasks }}/openvpn_client.yml"
    when: ansible_distribution_major_version != '7' and datacenter != 'phx2'
  - include: "{{ tasks }}/openvpn_client_7.yml"
    when: ansible_distribution_major_version == '7' and datacenter != 'phx2'
  - include: "{{ tasks }}/virthost.yml"

  handlers:
  - include: "{{ handlers }}/restart_services.yml"
